package com.waves.search.enums;

/**
 * @author Eden
 * @date 2024/10/12 21:22
 **/
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;
import java.util.Optional;

 @AllArgsConstructor
 @Getter
 public enum SearchTypeEnums  {
     USER(1,"用户"),
     TASK(2,"任务")
     ;

     private final Integer code;
     private final String desc;



     public static Optional<SearchTypeEnums> getEnumByCode(Integer code) {
         return Arrays.stream(SearchTypeEnums.values())
                 .filter(f -> Objects.equals(f.getCode(), code))
                 .findFirst();
     }
 }
